
Partial Class Admin_EditUser
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            If Request.QueryString("username") > "" Then
                UserProfile1.UserName = Request.QueryString("username")
                Dim user As MembershipUser = Membership.GetUser(UserProfile1.UserName)
                txtEmail.Text = user.Email
            Else
                UserProfile1.UserName = ""
                lblMsg.Text = "Invalid user. Please try again."
                lblMsg.Visible = True
            End If
        End If
    End Sub
    Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
        UserProfile1.SaveProfile()
        Dim user As MembershipUser = Membership.GetUser(UserProfile1.UserName)
        user.Email = txtEmail.Text
        Membership.UpdateUser(user)
        lblMsg.Text = "Saved"
        lblMsg.Visible = True
    End Sub  
End Class
